

<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-title" class="form-control" name="row[title]" type="text">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Desc')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-desc" class="form-control" name="row[desc]" type="text">
        </div>
    </div>
    <!--
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-type" class="form-control" name="row[type]" type="text">
        </div>
    </div>
    -->
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="c-content" class="form-control editor" rows="5" name="row[content]" cols="50"></textarea>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-image" class="form-control" size="50" name="row[image]" type="text" value="">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="faupload-image" class="btn btn-danger faupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-image"></span>
            </div>
            <ul class="row list-inline faupload-preview" id="p-image"></ul>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="radio">
                {foreach name="statusList" item="vo"}
                <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="1"}checked{/in} /> {$vo}</label>
                {/foreach}
            </div>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Send_type')}:</label>
        <div class="col-xs-12 col-sm-8">

            <select  id="c-send_type" class="form-control selectpicker" name="row[send_type]">
                {foreach name="sendTypeList" item="vo"}
                <option value="{$key}" {in name="key" value="1"}selected{/in}>{$vo}</option>
                {/foreach}
            </select>

        </div>
    </div>
    <!--
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('User_ids')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-user_ids" data-rule="required" data-source="user/user/index" data-field="nickname" data-multiple="true" class="form-control selectpage" name="row[user_ids]" type="text" value="">
        </div>
    </div>
    -->
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('User_ids')}:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea class="form-control" name="row[user_ids]" placeholder="请输入用户ID空格或回车间隔" ></textarea>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2"> </label>
        <div class="col-xs-12 col-sm-8">
            <a href="/news/index" data-toggle="tooltip" class="btn btn-xs btn-success btn-editone">排行榜</a>
            <a href="add.html" class="btn btn-xs btn-success btn-editone">月排行榜</a>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Reward')}:</label>
        <div class="col-xs-12 col-sm-8" id="div-content">
            <div onclick="jia()" id="jia-div" style="cursor:pointer;height: 30px;width:40px;background: #337ab7;line-height: 30px;color:white;text-align: center;border-radius:5px; "> + </div>
            <!--
            <div class="input-group"  >
                <span class="input-group-addon"> 赠送：</span>
                <select class="form-control" name="row[reward][]">
                    <?php foreach($data_list as $k1=>$val1): ?>
                    <option value="<?=$k1?>"><?=$val1?></option>
                    <?php endforeach; ?>
                </select>
                <span class="input-group-addon">数量：</span>
                <input   name="row[num][]" type="number" min="1" value="1" class="form-control">
                <span onclick="jian(this)" title="删除" class="input-group-addon" style="background: #777;color: white; cursor:pointer;">-</span>
            </div>
            -->
        </div>
    </div>

    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>

<script>
    function jia() {
        console.log(111);
        var html =`
        <div class="input-group">
                <span class="input-group-addon">赠送： </span>
                <select class="form-control" name="row[reward][]">
                    <?php foreach($data_list as $k1=>$val1): ?>
                        <option value="<?=$k1?>"><?=$val1?></option>
                    <?php endforeach; ?>
                </select>
                <span class="input-group-addon">数量：</span>
                <input   name="row[num][]" type="number" min="1" value="1" class="form-control">
                <span onclick="jian(this)" title="删除" class="input-group-addon" style="background: #777;color: white; cursor:pointer;">-</span>
            </div>
        `;
        $("#div-content").append(html);
    }

    function jian(obj) {
        $(obj).parent().remove();
    }

    function getDate(obj) {
        var month = $("#c-month").val();
        console.log(month);
        if(month){
            $.post("sign/getDate", {month:month}, function (tem) {
                console.log(tem);
                $("#date-div").html(tem);
            }, 'html')
        }

    }

</script>
